<?php 
	require_once ('checks.php');
	require_once ('Database.php');
	require_once ('Articles.php');
	$db= new DB();
	if (isset($_POST['go']) && isset($_POST['article_name'])) {
		$article = $db->extractArticle($_POST['article_name']);
		$db->deleteRecordInNews($article);
		$db->deleteRecordInArticles($article);
		unset($article);
		unset($db);
	}
 ?>

		
		<form method="post" action="?page=admin_delete_articles">
			<table>
				<tr>
					<td><label for="article">Article Name : </label>
					</td>
					<td><select name="article_name" id="article">
							<?php
								$arr = $db->findName("articles");
								$n= count($arr);
								for ($i=0;$i<$n;$i++) {
									echo "<option value='$arr[$i]'>$arr[$i]";
								}
							?>
					</select>
					</td>
				</tr>
				<tr>
					<td>						
					</td>
					<td ><input type="submit" value=" Delete " name="go" onclick="return confirm('Сигурни ли сте че искате да я изтриете?');">
					</td>				
				</tr>
			</table>
		</form>
